import requests
from config import url, headers_web

class Teaching:
    def __int__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_teachingid(cls,url: str, params=None,headers=headers_web,paramspath=None):
        '''
        @Summary:老师教过的课程信息
        @Description:云课堂调用
        :param url:
        :param params:
        :return:
        '''
        url = url + f"/teachingApi/v1/teachingcourse/{paramspath}"
        r = requests.get(url=url,headers=headers,params=params)
        return r

    @classmethod
    def post_classtimeroom(cls, url: str, params=None,headers=headers_web,json=None):
        '''
        @Summary:老师端获取课堂活动教室信息
        @Description:云课堂:老师端课堂活动调用
        :param url:
        :param params:
        :return:
        '''
        url = url + "/teachingApi/v1/teacher/classtimeroom"
        r = requests.post(url=url, headers=headers, params=params,json=json)
        return r

    @classmethod
    def get_classtimeinformation(cls, url: str,headers=headers_web, params=None):
        '''
        @Summary:老师上课课次选择列表
        @Description:云课堂调用
        :param url:
        :param params:
        :return:
        '''
        url = url + "/teachingApi/v1/classTimeInformation"
        r = requests.get(url=url, headers=headers, params=params)
        return r

if __name__ == '__main__':
    params = {
        "courseId": "1122102",
        "groupId": "b6d0852e-656e-4d86-9859-b963d2bb5d8f",
        "schoolYear": "2022-2023",
        "teacherId": "00cb0733-024b-42e3-9504-46325c36c5be",
        "term": "3",
        "validCode": "698a24469f055c70b42b4bc49a69322d"
    }
    from common.hashlib_utils import hash_md5
    teacherid = "00cb0733-024b-42e3-9504-46325c36c5be"
    valid_code4 = hash_md5("teacherId=" + str(teacherid) + "&signKey=123123")
    r = Teaching.get_classtimeinformation(url=url,params=params)
    print(r)
